home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Menus / Low Level / MenuBarObject.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  1.3 KB  |  49 lines  |  [TEXT/CWIE]

  1. // MenuBarObject.h
  2.  
  3. #ifndef MenuBarObject_h
  4. #define MenuBarObject_h
  5.  
  6. #ifndef Prepositions_h
  7. #include "Prepositions.h"
  8. #endif
  9. #ifndef MenuObject_h
  10. #include "MenuObject.h"
  11. #endif
  12. #ifndef MenuManagerUser_h
  13. #include "MenuManagerUser.h"
  14. #endif
  15. #ifndef MenuResult_h
  16. #include "MenuResult.h"
  17. #endif
  18. #ifndef Key_h
  19. #include "Key.h"
  20. #endif
  21.  
  22. enum AsSecondaryMenu{ asSubmenu, asPopup };
  23.  
  24. class MenuBarObject: public MenuManagerUser
  25.   {
  26.     public:
  27.         void Add( const MenuObject& menu, AfterEnd )                { InsertMenu( menu, 0 ); }
  28.         void Add( const MenuObject& menu, AsSecondaryMenu )    { InsertMenu( menu, -1 ); }
  29.         void Add( const MenuObject& menu, After, const MenuObject& previous )
  30.             { InsertMenu( menu, previous.ID() ); }
  31.         
  32.         void Remove( const MenuObject& menu )        { DeleteMenu( menu.ID() ); }
  33.         
  34.         void Highlight( const MenuObject& menu )    { HiliteMenu( menu.ID() ); }
  35.         void HighlightNone()                                { HiliteMenu( 0 ); }
  36.         
  37.         void Invert( const MenuObject& menu )        { FlashMenuBar( menu.ID() ); }
  38.         
  39.         int16 Height() const                                { return GetMBarHeight(); }
  40.         void Draw()                                            { DrawMenuBar(); }
  41.         void Invalidate()                                    { InvalMenuBar(); }
  42.         
  43.         MenuResult Click( Point p )                    { return MenuSelect( p ); }
  44.         MenuResult Key( ::Key );
  45.         MenuResult LastAttempt() const                { return MenuChoice(); }
  46.   };
  47.  
  48. #endif
  49.